#include <kanzi/core.ui/platform/graphics_backend/gl/renderer.hpp>
Classes | |
struct | RendererSettings |
Settings structure for the renderer construction. More... | |
struct | TextureUnitInfo |
Texture unit information structure. More... | |
Public Member Functions | |
void | addClearColor (unsigned int drawBuffer, uint32_t red, uint32_t green, uint32_t blue, uint32_t alpha) |
Registers color clear for an unsigned integer color buffer. More... | |
void | addClearColor (unsigned int drawBuffer, int32_t red, int32_t green, int32_t blue, int32_t alpha) |
Registers color clear for a signed integer color buffer. More... | |
void | addClearColor (unsigned int drawBuffer, float red, float green, float blue, float alpha) |
Registers color clear for a float color buffer. More... | |
void | addClearColor (unsigned int drawBuffer, ColorRGBA colorRGBA) |
Registers color clear for an unsigned normalized color buffer. More... | |
void | addClearColor (unsigned int drawBuffer, ClearMode clearMode) |
Registers color clear with value 0. More... | |
void | addClearTarget (GraphicsClearTarget target) |
Sets a clear target for the renderer. More... | |
void | advanceGlobalTime (chrono::milliseconds deltaTime) |
Advances renderer wall clock with time delta. More... | |
void | applyAttributePointer (unsigned int location, int dimension, GraphicsDataType dataType, int stride, const void *data) const |
For a given vertex attribute, specified by attribute location, configures attribute dimension, datatype, stride, and starting offset in the current vertex buffer. More... | |
void | applyAttributePointer (unsigned int location, int dimension, GraphicsDataType dataType, int stride, unsigned int divisor, const void *data) const |
For a given vertex or instance attribute specified by location, configures the dimension, datatype, stride, and starting offset in the current vertex buffer. More... | |
void | applyFixedUniformTime (int uniformLocation) |
Applies the Time fixed uniform. More... | |
void | applyFixedUniformWindowSize (int uniformLocation) |
Applies the WindowSize fixed uniform. More... | |
void | applyTexture (TextureType type, unsigned int textureUnit, unsigned int handle) |
Sets texture settings for a given texture unit. More... | |
void | applyTextureSizeUniforms (ShaderTextureUniform textureUniforms, unsigned int textureWidth, unsigned int textureHeight) |
Applies texture uniforms for the renderer. More... | |
void | applyTransformation (ShaderProgram &shaderProgram) |
Applies transformations from the renderer to the GPU. More... | |
void | applyTransformationUniform (ShaderProgram::FixedUniform uniform, int uniformLocation) |
Applies a single transformation uniform. More... | |
void | applyVertexAttributeArrays () |
Updates vertex attribute configurations to the graphics driver. More... | |
void | attachShaderToProgram (unsigned int programHandle, unsigned int shaderHandle) |
Attaches a shader to a program. More... | |
void | beginMaterialSetup () |
Begins a material for the renderer. More... | |
void | beginVertexArray () |
Begins a set of vertex arrays. More... | |
void | bindAttributeToLocation (unsigned int programHandle, unsigned int locationIndex, kzString attributeName) |
Binds an attribute to a given location index. For example, binds "kzPosition" to 0. More... | |
void | bindFramebuffer (unsigned int frameBufferHandle) |
Binds a framebuffer. More... | |
void | bindRenderbuffer (unsigned int renderbuffer) |
Binds a renderbuffer for editing. More... | |
unsigned int | bindTexture (TextureType type, unsigned int handle) |
Binds specified texture of specified type to the currently active texture unit. More... | |
void | calculateProjectionCameraWorldMatrix () |
Calculates the projection * camera * world matrix. More... | |
void | clear () |
Clears the currently bound framebuffer with requested buffers. More... | |
void | clearUniformCaches () |
Free memory used by uniform caches. More... | |
bool | compileSourceShader (ShaderType shaderType, unsigned int shaderHandle, const char *const shaderCode, string_view shaderName) |
Compiles a source shader and deploys it to the GPU. More... | |
void * | createImageObject (void *dataPointer, int target, int *attributes) |
Creates an image object, returns NULL if no hardware support. More... | |
unsigned int | createShader (ShaderType type) |
Creates a shader. More... | |
unsigned int | createShaderProgram () |
Creates a shader program. Returns the handle to the program. More... | |
void | deleteBuffer (unsigned int handle) |
Deletes vertex, index, or instance buffer. More... | |
void | deleteFramebuffer (unsigned int frameBufferHandle) |
Deletes a framebuffer. More... | |
void | deleteImageObject (void *imageObject) |
Deletes an image object created with createImageObject. More... | |
void | deleteRenderbuffer (unsigned int renderbuffer) |
Deletes a renderbuffer. More... | |
void | deleteShader (unsigned int shaderHandle) |
Deletes a shader. More... | |
void | deleteShaderProgram (unsigned int programHandle) |
Deletes a shader program and the attached shaders. More... | |
void | deleteTexture (unsigned int textureHandle) |
Deletes a texture through the renderer. More... | |
bool | deployBinaryProgram (unsigned int program, unsigned int binaryFormat, const void *data, size_t dataSize) |
Initializes shader program from program binary data. More... | |
bool | deployBinaryShader (unsigned int count, const unsigned int *shaders, unsigned int binaryFormat, const void *data, size_t dataSize) |
Deploys a binary shader. More... | |
void | detachShaderFromProgram (unsigned int programHandle, unsigned int shaderHandle) |
Detaches a shader from a program. More... | |
void | detachTexture (unsigned int textureUnit) |
Detaches all texture information from a given texture unit. More... | |
void | disableState (RendererState state) |
Disables a specific renderer state. More... | |
void | disableVertexAttributeArray (unsigned int attributeHandle) |
Sets vertex attribute array to be disabled. More... | |
void | disableWorkaround (Workaround workaround) |
Disables a renderer workaround. More... | |
void | drawBuffers () |
Renders the buffers that are currently bound. More... | |
void | enableState (RendererState state) |
Enables a specific renderer state. More... | |
void | enableVertexAttributeArray (unsigned int attributeHandle) |
Sets vertex attribute array to be enabled. More... | |
void | enableWorkaround (Workaround workaround) |
Enables a renderer workaround. More... | |
void | endMaterialSetup () |
Ends a material for the renderer. More... | |
void | endVertexArray (GraphicsPrimitiveType primitiveType, unsigned int count) |
Ends a vertex array. Renders the specified vertex lists and finishes the usage. More... | |
GraphicsFormat | findValidTextureFormat (GraphicsFormat format, unsigned int features) const |
Finds a valid texture format that is supported by the graphics adapter and is compatible with a given format. More... | |
void | flush () const |
Flushes the GPU pipeline, forces all commands to be executed in finite time. More... | |
void | framebufferRenderbuffer (Surface::APIAttachment attachment, unsigned int renderbuffer) |
Attaches a renderbuffer to the currently active framebuffer. More... | |
void | framebufferTexture2D (unsigned int glTextureImageTarget, Surface::APIAttachment attachment, unsigned int textureHandle, unsigned int mipmapLevel, unsigned int implicitSampleCount) |
Attaches a texture to the currently active framebuffer. More... | |
unsigned int | generateBuffer () |
Generates new index or vertex buffer or uniform buffer object name. More... | |
unsigned int | generateFramebuffer () |
Generates new texture for the renderer. More... | |
void | generateMipmaps (TextureType textureType) |
Generates mipmaps for the currently bound texture. More... | |
unsigned int | generateRenderbuffer () |
Generates a texture for the renderer. More... | |
unsigned int | generateTexture () |
Generates a new texture for the renderer. More... | |
SurfaceColorSpace | getActiveColorSpace () const |
Gets the active color space. More... | |
unsigned int | getActiveFramebuffer () const |
Gets the active framebuffer handle from the renderer. More... | |
GLGraphicsOutput * | getActiveGLGraphicsOutput () const |
Gets the active surface context from the renderer. More... | |
KzsGlGraphicsContext * | getActiveGraphicsContext () const |
float | getActiveScalar (GraphicsScalar scalar) const |
Returns a current scalar value from the renderer. More... | |
const int * | getActiveShaderAttributeMap () const |
Gets the active vertex attribute map from the renderer. More... | |
unsigned int | getActiveShaderHandle () const |
Gets the active shader handle from the renderer. More... | |
SurfaceClientAPI | getActiveSurfaceClientAPI () const |
::KzsOpenGlVendor | getActiveSurfaceVendor () const |
unsigned int | getBatchCount () const |
Gets the batch count from the renderer. This is the number of draw calls, such as drawElements and drawArrays. More... | |
int | getBlendMode () const |
Gets the blend mode from the renderer. More... | |
unsigned int | getBufferSwitchCount () const |
Gets the number of VBO and IBO switches from the renderer. More... | |
string | getCacheFilePath (const ShaderProgram::CreateInfo &info) |
Forms a full shader cache file path from the shader create info. More... | |
int | getColorReadFormat () |
Returns GL constant for the color read format used in reading back data from framebuffer (RendererReadPixels). More... | |
int | getColorReadType () |
Returns GL constant for the color read type used in reading back data from framebuffer (RendererReadPixels). More... | |
GraphicsColorWriteMode | getColorWriteMode () const |
Gets the current color write mode from the renderer. More... | |
GraphicsCullMode | getCullMode () const |
Gets the cull mode from the renderer. More... | |
const void * | getCurrentVertexArrayAttributeData (VertexAttribute::Semantic attribute) const |
Gets the current vertex array data from the renderer. Reset when switching the shader. More... | |
unsigned int | getCurrentVertexArrayFlags () const |
Gets the current vertex array flags from the renderer. More... | |
GraphicsFormat | getDepthStencilFormatForRenderbuffer (bool depth, bool stencil) const |
Returns a depth-stencil renderbuffer format which is supported by the renderer. More... | |
GraphicsFormat | getDepthStencilFormatForTexture (bool depth, bool stencil) const |
Returns a depth-stencil texture format which is supported by the renderer. More... | |
GraphicsCompareFunction | getDepthTest () const |
Gets the depth pass mode from the renderer. More... | |
DrawBuffers | getDrawBuffersSupport () const |
Returns the support for draw buffers. More... | |
bool | getDumpStateOnDrawCalls () const |
Returns current dump state on draw calls setting. More... | |
GraphicsFormat | getFallback (GraphicsFormat format, unsigned int usageFlags) const |
Returns a fallback format which supports specified usage flags. More... | |
unsigned int | getFeatures (GraphicsFormat format) const |
Describes what a format can be used for in the renderer. More... | |
FloatTexture | getFloatTextureSupport () const |
Returns the support for float texture format. More... | |
unsigned int | getFramebufferSwitchCount () const |
Gets the number of framebuffer switches from the renderer. More... | |
int | getGlesVersion () const |
Returns the supported OpenGL ES version. More... | |
void | getGLFormatTriplet (GraphicsFormat format, unsigned int features, unsigned int *out_glFormat, unsigned int *out_glInternalFormat, unsigned int *out_glType) const |
Returns GL API format, internal format, type triplet for given Format. More... | |
chrono::milliseconds | getGlobalTime () const |
Gets wall clock time in milliseconds since program start. More... | |
HalfFloatTexture | getHalfFloatTextureSupport () const |
Returns the support for half float texture format. More... | |
HalfFloatVertexAttribute | getHalfFloatVertexAttributeSupport () const |
Returns the support for half-float vertex attribute. More... | |
unsigned int | getHeavyweightCallCount () const |
Returns potentially heavyweight calls, such as buffer or texture updates and glFinish, from the renderer. More... | |
uint64_t | getIndexCount () const |
Gets the index count from the renderer. More... | |
uint64_t | getInstanceCount () const |
Gets the instance count from the renderer. More... | |
float | getLineWidth () const |
Gets the line width assigned to the renderer. More... | |
bool | getLogging () const |
Returns whether the logging of OpenGL API calls is enabled. More... | |
Matrix4x4 | getMatrix (FixedMatrix matrixType) const |
Gets a matrix from the renderer. More... | |
float | getMaximumAnisotropy () const |
Gets maximum anisotropy. More... | |
unsigned int | getMaximumRenderbufferSize () const |
Gets maximum renderbuffer size. More... | |
unsigned int | getMaximumSampleCount () const |
Gets maximum sample count for multisampling. More... | |
unsigned int | getMaximumTextureSize (TextureType textureType) const |
Gets maximum texture side size. More... | |
unsigned int | getMaximumVertexAttributeCount () const |
Gets maximum vertex attribute count. More... | |
unsigned int | getMaximumViewportHeight () const |
Gets maximum viewport height. More... | |
unsigned int | getMaximumViewportWidth () const |
Gets maximum viewport width. More... | |
Multisample | getMultisampleSupport () const |
Returns the support for multisample textures and renderbuffers. More... | |
GraphicsFormat | getNativePixelReadFormat () |
Gets the native pixel read format from the renderer. More... | |
Vector2 | getPolygonDepthOffset () const |
Gets the polygon depth offset assigned to the renderer. More... | |
string | getProgramBinary (unsigned int program, unsigned int &binaryFormat) |
Gets the binary representation for a GL shader program. More... | |
ProgramBinary | getProgramBinarySupport () const |
Returns the support for program binaries. More... | |
ViewportRectangle | getScissor () const |
Gets the current scissor rectangle from the renderer. More... | |
unsigned int | getShaderSwitchCount () const |
Gets the number of shader switches from the renderer. More... | |
bool | getState (RendererState state) const |
Returns the state of a specific renderer state. More... | |
void | getStencilFunction (GraphicsCompareFunction *out_stencilCompareFunction, unsigned int *out_referenceValue, unsigned int *out_maskValue) const |
Gets a stencil function from the renderer. More... | |
void | getStencilOperation (GraphicsStencilOperation *out_stencilFailOperation, GraphicsStencilOperation *out_stencilPassDepthFailOperation, GraphicsStencilOperation *out_stencilPassDepthPassOperation) const |
Gets a stencil operation from the renderer. More... | |
TexStorage | getTexStorageSupport () const |
Returns the support for tex storage. More... | |
bool | getTexStorageSupport (TextureType type, unsigned int samples) const |
Returns the support for tex storage. More... | |
unsigned int | getTextureSwitchCount () const |
Gets the number of texture switches from the renderer. More... | |
uint64_t | getTriangleCount () const |
Gets the triangle count from the renderer. More... | |
unsigned int | getUniformArrayLength (const char *uniformName) const |
Returns array uniform length for given uniform. More... | |
int | getUniformLocationSlow (const string &uniformName) const |
Finds uniform location for given uniform from active shader. More... | |
unsigned int | getUniformSendCount () const |
Gets uniform sending count from the renderer. More... | |
uint64_t | getVertexCount () const |
Gets the vertex count from the renderer. More... | |
ViewportRectangle | getViewport () const |
Gets the current viewport rectangle from the renderer. More... | |
bool | GPUCallsIsEnabled () const |
Returns whether GPU calls are enabled. More... | |
bool | hasClearTarget (GraphicsClearTarget target) const |
Returns whether the renderer has a specific clear target. More... | |
void | initialize (const RendererSettings &rendererSettings) |
Initializes the renderer object. More... | |
void | invalidateAllocations () |
Invalidates all handles from renderer without affecting GL state. More... | |
void | invalidateFramebufferAttachments (FramebufferTarget target, bitset< Surface::APIAttachmentCount > attachments) const |
Invalidates framebuffer attachments. More... | |
bool | isClearEnabled () const |
Returns whether clear is enabled. More... | |
bool | isFramebufferComplete () |
Returns whether the framebuffer status is complete. More... | |
bool | isHalfFloatVertexAttributeSupported () const |
Returns whether half-float vertex attribute is supported. More... | |
bool | isInitialized () const |
Returns whether the renderer is initialized. More... | |
bool | isProgramBinaryFormatSupported (unsigned int glProgramBinaryFormat) const |
Returns whether a GL program binary format is supported. More... | |
bool | isShaderBinaryFormatSupported (unsigned int glShaderBinaryFormat) const |
Returns whether a GL shader binary format is supported. More... | |
bool | isSupported (RendererSupport feature) const |
Returns whether coverage buffer is supported. More... | |
bool | isWorkaroundEnabled (Workaround workaround) const |
Return whether a workaround is enabled. More... | |
bool | linkShaderProgram (unsigned int programHandle, kzString shaderName) |
Links a shader program with a given handle. More... | |
bool | loadProgramFromCache (const ShaderProgram::CreateInfo &info, unsigned int program) |
Tries to load a shader program from the cache. More... | |
void | logOpenGLInformation (unsigned int flags) const |
Logs information about renderer capabilities. More... | |
void * | mapIndexBuffer (unsigned int size, BufferAccessMode mode) |
Maps index buffer. More... | |
void * | mapVertexBuffer (unsigned int size, BufferAccessMode mode) |
Maps vertex or instance buffer. More... | |
void | popStatistics () |
void | pushStatistics () |
void | readPixels (int x, int y, int width, int height, GraphicsFormat format, void *pixels) |
Reads the pixels from the current framebuffer. More... | |
void | refreshRenderContext (bool geometryRendering) |
Refreshes the render context to contain all proper states. More... | |
void | removeClearTarget (GraphicsClearTarget target) |
Removes a clearing target for the renderer. More... | |
void | renderbufferStorage (GraphicsFormat format, unsigned int width, unsigned int height, unsigned int explicitSampleCount) |
Sets storage for the currently bound renderbuffer. More... | |
Renderer () | |
Creates a renderer object. More... | |
void | reset () |
Resets the renderer. For example, resets the caches and states of the renderer, and syncs renderer variables with GL states. More... | |
void | resetActiveFramebuffer () |
Resets the active framebuffer for the renderer to the default (screen). More... | |
void | resetClearTarget () |
Resets the clear targets for the renderer. More... | |
void | resetFrame () |
Resets the frame for the core renderer, that is, counters for logging rendering information, such as triangle count. More... | |
void | resolveMultisample (NativeFramebufferHandle sourceFramebuffer, NativeFramebufferHandle destinationFramebuffer, unsigned int srcOffsetX, unsigned int srcOffsetY, unsigned int srcWidth, unsigned int srcHeight, unsigned int dstOffsetX, unsigned int dstOffsetY, unsigned int dstWidth, unsigned int dstHeight, bool color, bool depth, bool stencil) |
Resolves a multisample framebuffer. More... | |
void | resolveMultisample (NativeFramebufferHandle sourceFramebuffer, NativeFramebufferHandle destinationFramebuffer, unsigned int srcOffsetX, unsigned int srcOffsetY, unsigned int srcWidth, unsigned int srcHeight, unsigned int dstOffsetX, unsigned int dstOffsetY, unsigned int dstWidth, unsigned int dstHeight) |
Resolves a multisample framebuffer. More... | |
void | resolveMultisample (Texture &src, Texture &dst, unsigned int offsetX, unsigned int offsetY, unsigned int width, unsigned int height, bool color, bool depth) |
Resolves multisample samples from a source texture to a destination texture. More... | |
void | resolveMultisample (Texture &src, Texture &dst, unsigned int offsetX, unsigned int offsetY, unsigned int width, unsigned int height) |
Resolves multisample samples from a source texture to a destination texture. More... | |
void | saveProgramToCache (const ShaderProgram::CreateInfo &info, unsigned int program) |
Saves a shader program to cache. More... | |
void | setActiveFramebuffer (unsigned int frameBufferHandle) |
Sets the active framebuffer for the renderer. More... | |
void | setActiveFramebufferCallback (FramebufferCallback callbackFunction) |
Sets the callback function that is called after setActiveFramebuffer. More... | |
void | setActiveGLGraphicsOutput (GLGraphicsOutput *glGraphicsOutput) |
Sets the active surface context for the renderer. More... | |
void | setActiveScalar (GraphicsScalar scalar, float value) |
Switches a scalar value for the renderer if necessary. For example, a depth clear value. More... | |
void | setActiveShaderHandle (unsigned int activeShaderHandle, const int *vertexAttributeMap) |
Sets the active shader for the renderer. More... | |
void | setActiveTextureUnit (unsigned int textureUnit) |
Sets the currently active texture unit. More... | |
void | setBlendMode (int blendMode) |
Sets a blend mode for the renderer. More... | |
void | setClearColor (ColorRGBA colorRGBA) |
Sets the clear color for the renderer. More... | |
void | setClearDepthValue (float clearDepthValue) |
Sets clear depth for the renderer. More... | |
void | setClearStencil (int stencilClearValue) |
Sets clear stencil for the renderer. More... | |
void | setColorBufferCount (unsigned int colorBufferCount) |
Sets the number of draw color buffers for the currently active framebuffer. More... | |
void | setColorWriteMode (GraphicsColorWriteMode colorWriteMode) |
Set a color write mode for the renderer. More... | |
void | setCullMode (GraphicsCullMode cullMode) |
Sets a cull mode for the renderer. More... | |
void | setDefaultFramebuffer (unsigned int frameBufferHandle) |
Sets the default framebuffer (screen) for the renderer. More... | |
void | setDepthTest (GraphicsCompareFunction depthMode) |
Sets a depth pass mode for the renderer. More... | |
void | setFillMode (GraphicsFillMode mode) |
Sets the polygon fill mode if supported by the backend. More... | |
void | setGPUCallsEnabled (bool enabled) |
Sets GPU calls as enabled or disabled. More... | |
void | setHasTessellationShader (bool hasTessellationShader) |
Sets whether the current program has an active tessellation shader, which requires overriding the primitive type to GL_PATCHES. More... | |
void | setImageTargetTexture (TextureType type, void *imageObject) |
Sets an image object bound to the currently bound texture type. More... | |
void | setIndexBuffer (unsigned int indexBuffer) |
Sets an index buffer for the renderer. More... | |
void | setIndexBufferData (size_t dataSize, const void *data) |
Sets static index buffer data. More... | |
void | setIndexBufferSubData (unsigned int offset, size_t size, const void *data) |
Uploads index buffer subdata with given offset and size. More... | |
void | setIndexCount (unsigned int indexCount) |
Sets the index count for the renderer. More... | |
void | setIndexData (void *indexData) |
Sets the index data for the renderer. More... | |
void | setIndexData (void *indexData, IndexBufferType type) |
Sets the index data for the renderer. More... | |
void | setInstanceCount (unsigned int instanceCount) |
Sets the instance count for the renderer. More... | |
void | setLineWidth (float lineWidth) |
Sets the line width for the renderer. More... | |
void | setLogging (bool enabled, bool dumpStateOnDrawCalls) |
Enables or disables the logging of OpenGL API calls. More... | |
void | setMatrix (FixedMatrix matrixType, Matrix4x4 matrix) |
Sets a matrix for the renderer. More... | |
void | setPixelStorePack (unsigned int packBytes) |
Sets pack row alignment in memory. More... | |
void | setPixelStoreUnpack (unsigned int unpackBytes) |
Sets unpack row alignment in memory. More... | |
bool | setPixelStoreUnpackRowLength (unsigned int rowLength) |
Sets the unpack row length. More... | |
void | setPolygonDepthOffset (Vector2 offset) |
Sets the polygon depth offset for the renderer. More... | |
void | setPolygonDepthOffset (float derivativeMultiplier, float constantMultiplier) |
Sets the polygon depth offset for the renderer. More... | |
void | setPrimitiveType (GraphicsPrimitiveType prmitiveType) |
Sets the primitive type for the renderer. More... | |
void | setScissorTest (optional< ViewportRectangle > scissor) |
Sets the scissor test state and optional rectangle for the renderer. More... | |
void | setScreenSize (Vector2 screenSize) |
Sets the current screen size. More... | |
void | setState (RendererState state, bool enable) |
Enables or disables the state of a specific renderer state. More... | |
void | setStencilFunction (GraphicsCompareFunction stencilCompareFunction, unsigned int referenceValue, unsigned int maskValue) |
Sets a stencil function for the renderer. More... | |
void | setStencilOperation (GraphicsStencilOperation stencilFailOperation, GraphicsStencilOperation stencilPassDepthFailOperation, GraphicsStencilOperation stencilPassDepthPassOperation) |
Sets a stencil operation for the renderer. More... | |
void | setTextureAddressingMode (TextureType type, Sampler::AddressingMode texAddress) |
Sets the wrap mode for the currently bound texture in the current texture unit. More... | |
void | setTextureCompare (TextureType type, bool isEnabled, GraphicsCompareFunction textureCompareFunction) |
Sets the texture comparison function for the currently bound texture in the current texture unit. More... | |
void | setTextureFilter (TextureType type, Sampler::Filter minificationFilter, Sampler::Filter magnificationFilter, Sampler::MipmapMode mipmapMode, float anisotropy) |
Sets the texture filter for the currently bound texture in the current texture unit. More... | |
void | setTextureImage2D (unsigned int glTextureImageTarget, unsigned int mipmapLevel, GraphicsFormat format, unsigned int width, unsigned int height, const void *data) |
Uploads texture data to the GPU. More... | |
void | setTextureSubImage2D (unsigned int glTextureImageTarget, unsigned int mipmapLevel, GraphicsFormat format, unsigned int x, unsigned int y, unsigned int width, unsigned int height, const void *data) |
Uploads texture subimage data to the GPU. More... | |
void | setTextureSwizzleEachChannel (TextureType target, const TextureSwizzleMask &mask) |
Sets the texture swizzle mask for each channel separately. More... | |
void | setTextureSwizzleMask (TextureType target, const TextureSwizzleMask &mask) |
Sets the texture swizzle mask for the color and alpha channels. More... | |
void | setUniformColorArray (int uniformLocation, unsigned int count, const ColorRGBA *values) |
Sets a vector array with dimension to the renderer, using the currently bound shader. More... | |
void | setUniformColorRGBA (const ColorRGBA &value, int uniformLocation) |
Sets a ColorRGBA uniform for the renderer, using the currently bound shader. More... | |
void | setUniformFloat (const float &value, int uniformLocation) |
Sets a floating point uniform for the renderer, using the currently bound shader. More... | |
void | setUniformFloatArray (int uniformLocation, unsigned int count, const float *values) |
Sets a float array with dimension to the renderer using the currently bound shader. More... | |
void | setUniformIntArray (int uniformLocation, unsigned int count, const int *values) |
Sets an integer array with dimension to the renderer using the currently bound shader. More... | |
void | setUniformInteger (const int &value, int uniformLocation) |
Sets an integer uniform for the renderer, using the currently bound shader. More... | |
void | setUniformMatArray (int uniformLocation, unsigned int count, const Matrix3x3 *values) |
Sets a matrix array with dimension to the renderer, using the currently bound shader. More... | |
void | setUniformMatArray (int uniformLocation, unsigned int count, const Matrix4x4 *values) |
Sets a matrix array with dimension to the renderer, using the currently bound shader. More... | |
void | setUniformMatrix3x3 (const Matrix3x3 &value, int uniformLocation) |
Sets a Matrix3x3 uniform for the renderer, using the currently bound shader. More... | |
void | setUniformMatrix4x4 (const Matrix4x4 &value, int uniformLocation) |
Sets a Matrix4x4 uniform for the renderer, using the currently bound shader. More... | |
void | setUniformTexture (int uniformLocation, unsigned int textureUnit) |
Sets the uniform for a texture based on the currently active texture unit. More... | |
void | setUniformVec2 (const Vector2 &value, int uniformLocation) |
Sets a Vector2 uniform for the renderer, using the currently bound shader. More... | |
void | setUniformVec3 (const Vector3 &value, int uniformLocation) |
Sets a Vector3 uniform for the renderer, using the currently bound shader. More... | |
void | setUniformVec4 (const Vector4 &value, int uniformLocation) |
Sets Vector4 uniform for the renderer, using the currently bound shader. More... | |
void | setUniformVecArray (int uniformLocation, unsigned int count, const Vector2 *values) |
Sets a vector array with dimension to the renderer, using the currently bound shader. More... | |
void | setUniformVecArray (int uniformLocation, unsigned int count, const Vector3 *values) |
Sets a vector array with dimension to the renderer, using the currently bound shader. More... | |
void | setUniformVecArray (int uniformLocation, unsigned int count, const Vector4 *values) |
Sets a vector array with dimension to the renderer, using the currently bound shader. More... | |
void | setVertexArrayData (VertexAttribute::Semantic attribute, GraphicsDataType dataType, const void *data, unsigned int stride) |
Sets vertex array data. More... | |
void | setVertexArrayData (VertexAttribute::Semantic attribute, GraphicsDataType dataType, const void *data) |
Sets vertex array data wrapper. More... | |
void | setVertexArrayData (VertexAttribute::Semantic attribute, const void *data, unsigned int stride) |
Sets vertex array data wrapper. More... | |
void | setVertexArrayData (VertexAttribute::Semantic attribute, const void *data) |
Sets vertex array data wrapper. More... | |
void | setVertexBuffer (unsigned int vertexBuffer) |
Sets a vertex or instance buffer for the renderer. More... | |
void | setVertexBufferData (size_t dataSize, const void *data) |
Sets static vertex buffer data. More... | |
void | setVertexBufferPointer (unsigned int location, int dimension, GraphicsDataType attributeDataType, int stride, const void *data) |
Sets the attribute data source for the currently enabled vertex attribute array. More... | |
void | setVertexBufferPointer (unsigned int location, int dimension, GraphicsDataType attributeDataType, int stride, unsigned int divisor, const void *data) |
Sets the attribute data source for the currently enabled vertex attribute array. More... | |
void | setVertexBufferSubData (unsigned int offset, size_t size, const void *data) |
Uploads vertex buffer subdata with given offset and size. More... | |
void | setVertexCount (unsigned int vertexCount) |
Sets the vertex count for the renderer. More... | |
void | setViewport (ViewportRectangle viewport) |
Sets an active viewport for the renderer. More... | |
void | setWorkaroundEnable (Workaround workaround, bool enabled) |
Sets workaround enable state to true or false. More... | |
bool | supports (GraphicsFormat format, unsigned int features) const |
Returns whether a format supports requested features. More... | |
bool | supportsColorAttachment (GraphicsFormat format) const |
Returns whether a format can be used as color attachment in framebuffers. More... | |
bool | supportsDepthStencilAttachment (GraphicsFormat format) const |
Returns whether a format can be used as depth-stencil attachment in framebuffers. More... | |
bool | supportsRenderbuffer (GraphicsFormat format) const |
Returns whether a format can be used as renderbuffer by the renderer. More... | |
bool | supportsTexStorage (GraphicsFormat format, unsigned int features) const |
Returns whether a graphics format supports texture storage. More... | |
bool | supportsTexture (GraphicsFormat format) const |
Returns whether a format can be used as a texture by the renderer. More... | |
void | textureStorage (TextureType type, int sampleCount, int mipmapLevelCount, GraphicsFormat format, unsigned int width, unsigned int height, unsigned int depth, bool fixedSampleLocations) |
Specifies immutable texture format and shape. More... | |
void | uninitialize () |
Uninitializes the renderer object. More... | |
bool | unmapIndexBuffer () |
Unmaps index buffer. More... | |
bool | unmapVertexBuffer () |
Unmaps vertex or instance buffer. More... | |
void | updateSettings (const RendererSettings &rendererSettings) |
Updates the renderer settings. More... | |
~Renderer () | |
Static Public Member Functions | |
static ClearMode | getClearMode (GraphicsFormat format) |
Friends | |
RenderingChangeStateFlag & | operator&= (RenderingChangeStateFlag &lhs, int rhs) |
And assignment operator for rendering change state flags. More... | |
RenderingChangeStateFlag & | operator^= (RenderingChangeStateFlag &lhs, int rhs) |
Xor assignment operator for rendering change state flags. More... | |
RenderingChangeStateFlag & | operator|= (RenderingChangeStateFlag &lhs, int rhs) |
Or assignment operator for rendering change state flags. More... | |
typedef void(* kanzi::Renderer::FramebufferCallback) (unsigned int frameBufferHandle) |
Callback prototype for setActiveFramebuffer.
Rendering change flag type.
Kanzi internally sets the bits to flag which rendering settings have changed.
Per-color buffer clear setting.
|
strong |
|
explicit |
Creates a renderer object.
kanzi::Renderer::~Renderer | ( | ) |
void kanzi::Renderer::resetFrame | ( | ) |
Resets the frame for the core renderer, that is, counters for logging rendering information, such as triangle count.
void kanzi::Renderer::reset | ( | ) |
Resets the renderer. For example, resets the caches and states of the renderer, and syncs renderer variables with GL states.
void kanzi::Renderer::initialize | ( | const RendererSettings & | rendererSettings | ) |
Initializes the renderer object.
Requires a graphics context.
rendererSettings | Settings structure for initializing the renderer. |
void kanzi::Renderer::updateSettings | ( | const RendererSettings & | rendererSettings | ) |
Updates the renderer settings.
After initialization, you can change only the shader binary cache settings.
rendererSettings | Settings structure to set to the renderer. |
void kanzi::Renderer::uninitialize | ( | ) |
Uninitializes the renderer object.
bool kanzi::Renderer::isInitialized | ( | ) | const |
Returns whether the renderer is initialized.
void kanzi::Renderer::setActiveGLGraphicsOutput | ( | GLGraphicsOutput * | glGraphicsOutput | ) |
Sets the active surface context for the renderer.
GLGraphicsOutput* kanzi::Renderer::getActiveGLGraphicsOutput | ( | ) | const |
Gets the active surface context from the renderer.
KzsGlGraphicsContext* kanzi::Renderer::getActiveGraphicsContext | ( | ) | const |
SurfaceClientAPI kanzi::Renderer::getActiveSurfaceClientAPI | ( | ) | const |
SurfaceColorSpace kanzi::Renderer::getActiveColorSpace | ( | ) | const |
Gets the active color space.
::KzsOpenGlVendor kanzi::Renderer::getActiveSurfaceVendor | ( | ) | const |
void kanzi::Renderer::enableState | ( | RendererState | state | ) |
Enables a specific renderer state.
void kanzi::Renderer::disableState | ( | RendererState | state | ) |
Disables a specific renderer state.
void kanzi::Renderer::setState | ( | RendererState | state, |
bool | enable | ||
) |
Enables or disables the state of a specific renderer state.
bool kanzi::Renderer::getState | ( | RendererState | state | ) | const |
Returns the state of a specific renderer state.
void kanzi::Renderer::clear | ( | ) |
Clears the currently bound framebuffer with requested buffers.
To request buffers to be cleared, use the addClearTarget() and addClearColor() functions.
void kanzi::Renderer::resetClearTarget | ( | ) |
Resets the clear targets for the renderer.
void kanzi::Renderer::addClearTarget | ( | GraphicsClearTarget | target | ) |
Sets a clear target for the renderer.
target | The buffer to clear: kanzi::GraphicsClearTargetColor0, kanzi::GraphicsClearTargetDepth, or kanzi::GraphicsClearTargetStencil. |
|
static |
void kanzi::Renderer::addClearColor | ( | unsigned int | drawBuffer, |
uint32_t | red, | ||
uint32_t | green, | ||
uint32_t | blue, | ||
uint32_t | alpha | ||
) |
Registers color clear for an unsigned integer color buffer.
To perform all registered clears, call clear().
drawBuffer | Index of the color buffer to clear: 0..3. |
red | Clear color red channel value. |
green | Clear color green channel value. |
blue | Clear color blue channel value. |
alpha | Clear color alpha channel value. |
void kanzi::Renderer::addClearColor | ( | unsigned int | drawBuffer, |
int32_t | red, | ||
int32_t | green, | ||
int32_t | blue, | ||
int32_t | alpha | ||
) |
Registers color clear for a signed integer color buffer.
To perform all registered clears, call clear().
drawBuffer | Index of the color buffer to clear: 0..3. |
red | Clear color red channel value. |
green | Clear color green channel value. |
blue | Clear color blue channel value. |
alpha | Clear color alpha channel value. |
void kanzi::Renderer::addClearColor | ( | unsigned int | drawBuffer, |
float | red, | ||
float | green, | ||
float | blue, | ||
float | alpha | ||
) |
Registers color clear for a float color buffer.
To perform all registered clears, call clear().
drawBuffer | Index of the color buffer to clear: 0..3 for OpenGL ES 3, 0 for OpenGL ES 2. |
red | Clear color red channel value. |
green | Clear color green channel value. |
blue | Clear color blue channel value. |
alpha | Clear color alpha channel value. |
void kanzi::Renderer::addClearColor | ( | unsigned int | drawBuffer, |
ColorRGBA | colorRGBA | ||
) |
Registers color clear for an unsigned normalized color buffer.
To perform all registered clears, call clear().
drawBuffer | Index of the color buffer to clear: 0..3 for OpenGL ES 3, 0 for OpenGL ES 2. |
colorRGBA | RGBA clear color. |
void kanzi::Renderer::addClearColor | ( | unsigned int | drawBuffer, |
ClearMode | clearMode | ||
) |
Registers color clear with value 0.
To perform all registered clears, call clear().
drawBuffer | Index of the color buffer to clear: 0..3 for OpenGL ES 3, 0 for OpenGL ES 2. |
clearMode | Renderer::ClearMode of the color buffer. |
void kanzi::Renderer::removeClearTarget | ( | GraphicsClearTarget | target | ) |
Removes a clearing target for the renderer.
bool kanzi::Renderer::hasClearTarget | ( | GraphicsClearTarget | target | ) | const |
Returns whether the renderer has a specific clear target.
bool kanzi::Renderer::isClearEnabled | ( | ) | const |
Returns whether clear is enabled.
void kanzi::Renderer::setClearColor | ( | ColorRGBA | colorRGBA | ) |
Sets the clear color for the renderer.
void kanzi::Renderer::setColorWriteMode | ( | GraphicsColorWriteMode | colorWriteMode | ) |
Set a color write mode for the renderer.
GraphicsColorWriteMode kanzi::Renderer::getColorWriteMode | ( | ) | const |
Gets the current color write mode from the renderer.
void kanzi::Renderer::setScissorTest | ( | optional< ViewportRectangle > | scissor | ) |
Sets the scissor test state and optional rectangle for the renderer.
void kanzi::Renderer::setClearDepthValue | ( | float | clearDepthValue | ) |
Sets clear depth for the renderer.
void kanzi::Renderer::setClearStencil | ( | int | stencilClearValue | ) |
Sets clear stencil for the renderer.
void kanzi::Renderer::setViewport | ( | ViewportRectangle | viewport | ) |
Sets an active viewport for the renderer.
void kanzi::Renderer::setVertexBuffer | ( | unsigned int | vertexBuffer | ) |
Sets a vertex or instance buffer for the renderer.
void kanzi::Renderer::setIndexBuffer | ( | unsigned int | indexBuffer | ) |
Sets an index buffer for the renderer.
void kanzi::Renderer::drawBuffers | ( | ) |
Renders the buffers that are currently bound.
void kanzi::Renderer::setVertexCount | ( | unsigned int | vertexCount | ) |
Sets the vertex count for the renderer.
void kanzi::Renderer::setIndexCount | ( | unsigned int | indexCount | ) |
Sets the index count for the renderer.
void kanzi::Renderer::setIndexData | ( | void * | indexData | ) |
Sets the index data for the renderer.
void kanzi::Renderer::setIndexData | ( | void * | indexData, |
IndexBufferType | type | ||
) |
Sets the index data for the renderer.
void kanzi::Renderer::setPrimitiveType | ( | GraphicsPrimitiveType | prmitiveType | ) |
Sets the primitive type for the renderer.
void kanzi::Renderer::setInstanceCount | ( | unsigned int | instanceCount | ) |
Sets the instance count for the renderer.
int kanzi::Renderer::getUniformLocationSlow | ( | const string & | uniformName | ) | const |
Finds uniform location for given uniform from active shader.
Kanzi stores the data in the uniform cache and fetches the data from the cache in subsequent calls.
unsigned int kanzi::Renderer::getUniformArrayLength | ( | const char * | uniformName | ) | const |
Returns array uniform length for given uniform.
If uniform with given name is not found, returns 0. If uniform is not an array, returns 1.
void kanzi::Renderer::setUniformIntArray | ( | int | uniformLocation, |
unsigned int | count, | ||
const int * | values | ||
) |
Sets an integer array with dimension to the renderer using the currently bound shader.
uniformLocation | Uniform location ID. |
count | Number of entries to set. |
values | Values to set. |
void kanzi::Renderer::setUniformFloatArray | ( | int | uniformLocation, |
unsigned int | count, | ||
const float * | values | ||
) |
Sets a float array with dimension to the renderer using the currently bound shader.
uniformLocation | Uniform location ID. |
count | Number of entries to set. |
values | Values to set. |
void kanzi::Renderer::setUniformVecArray | ( | int | uniformLocation, |
unsigned int | count, | ||
const Vector2 * | values | ||
) |
Sets a vector array with dimension to the renderer, using the currently bound shader.
uniformLocation | Uniform location ID. |
count | Number of entries to set. |
values | Values to set. |
void kanzi::Renderer::setUniformVecArray | ( | int | uniformLocation, |
unsigned int | count, | ||
const Vector3 * | values | ||
) |
Sets a vector array with dimension to the renderer, using the currently bound shader.
uniformLocation | Uniform location ID. |
count | Number of entries to set. |
values | Values to set. |
void kanzi::Renderer::setUniformVecArray | ( | int | uniformLocation, |
unsigned int | count, | ||
const Vector4 * | values | ||
) |
Sets a vector array with dimension to the renderer, using the currently bound shader.
uniformLocation | Uniform location ID. |
count | Number of entries to set. |
values | Values to set. |
void kanzi::Renderer::setUniformColorArray | ( | int | uniformLocation, |
unsigned int | count, | ||
const ColorRGBA * | values | ||
) |
Sets a vector array with dimension to the renderer, using the currently bound shader.
uniformLocation | Uniform location ID. |
count | Number of entries to set. |
values | Values to set. |
void kanzi::Renderer::setUniformMatArray | ( | int | uniformLocation, |
unsigned int | count, | ||
const Matrix3x3 * | values | ||
) |
Sets a matrix array with dimension to the renderer, using the currently bound shader.
uniformLocation | Uniform location ID. |
count | Number of entries to set. |
values | Values to set. |
void kanzi::Renderer::setUniformMatArray | ( | int | uniformLocation, |
unsigned int | count, | ||
const Matrix4x4 * | values | ||
) |
Sets a matrix array with dimension to the renderer, using the currently bound shader.
uniformLocation | Uniform location ID. |
count | Number of entries to set. |
values | Values to set. |
|
inline |
Sets an integer uniform for the renderer, using the currently bound shader.
value | Value to set. |
uniformLocation | Uniform location ID. |
|
inline |
Sets a floating point uniform for the renderer, using the currently bound shader.
value | Value to set. |
uniformLocation | Uniform location ID. |
|
inline |
Sets a Vector2 uniform for the renderer, using the currently bound shader.
value | Value to set. |
uniformLocation | Uniform location ID. |
|
inline |
Sets a Vector3 uniform for the renderer, using the currently bound shader.
value | Value to set. |
uniformLocation | Uniform location ID. |
|
inline |
Sets Vector4 uniform for the renderer, using the currently bound shader.
value | Value to set. |
uniformLocation | Uniform location ID. |
|
inline |
Sets a ColorRGBA uniform for the renderer, using the currently bound shader.
value | Value to set. |
uniformLocation | Uniform location ID. |
|
inline |
Sets a Matrix3x3 uniform for the renderer, using the currently bound shader.
value | Value to set. |
uniformLocation | Uniform location ID. |
|
inline |
Sets a Matrix4x4 uniform for the renderer, using the currently bound shader.
value | Value to set. |
uniformLocation | Uniform location ID. |
void kanzi::Renderer::setActiveScalar | ( | GraphicsScalar | scalar, |
float | value | ||
) |
Switches a scalar value for the renderer if necessary. For example, a depth clear value.
float kanzi::Renderer::getActiveScalar | ( | GraphicsScalar | scalar | ) | const |
Returns a current scalar value from the renderer.
void kanzi::Renderer::setBlendMode | ( | int | blendMode | ) |
Sets a blend mode for the renderer.
blendMode
parameter changed from GraphicsBlendMode to int. int kanzi::Renderer::getBlendMode | ( | ) | const |
Gets the blend mode from the renderer.
blendMode
parameter changed from GraphicsBlendMode to int. void kanzi::Renderer::setCullMode | ( | GraphicsCullMode | cullMode | ) |
Sets a cull mode for the renderer.
GraphicsCullMode kanzi::Renderer::getCullMode | ( | ) | const |
Gets the cull mode from the renderer.
void kanzi::Renderer::setDepthTest | ( | GraphicsCompareFunction | depthMode | ) |
Sets a depth pass mode for the renderer.
GraphicsCompareFunction kanzi::Renderer::getDepthTest | ( | ) | const |
Gets the depth pass mode from the renderer.
void kanzi::Renderer::setStencilFunction | ( | GraphicsCompareFunction | stencilCompareFunction, |
unsigned int | referenceValue, | ||
unsigned int | maskValue | ||
) |
Sets a stencil function for the renderer.
void kanzi::Renderer::setStencilOperation | ( | GraphicsStencilOperation | stencilFailOperation, |
GraphicsStencilOperation | stencilPassDepthFailOperation, | ||
GraphicsStencilOperation | stencilPassDepthPassOperation | ||
) |
Sets a stencil operation for the renderer.
void kanzi::Renderer::getStencilFunction | ( | GraphicsCompareFunction * | out_stencilCompareFunction, |
unsigned int * | out_referenceValue, | ||
unsigned int * | out_maskValue | ||
) | const |
Gets a stencil function from the renderer.
void kanzi::Renderer::getStencilOperation | ( | GraphicsStencilOperation * | out_stencilFailOperation, |
GraphicsStencilOperation * | out_stencilPassDepthFailOperation, | ||
GraphicsStencilOperation * | out_stencilPassDepthPassOperation | ||
) | const |
Gets a stencil operation from the renderer.
void kanzi::Renderer::setMatrix | ( | FixedMatrix | matrixType, |
Matrix4x4 | matrix | ||
) |
Sets a matrix for the renderer.
Matrix4x4 kanzi::Renderer::getMatrix | ( | FixedMatrix | matrixType | ) | const |
Gets a matrix from the renderer.
void kanzi::Renderer::calculateProjectionCameraWorldMatrix | ( | ) |
Calculates the projection * camera * world matrix.
This matrix transforms a point or matrix from local space to screen space.
void kanzi::Renderer::applyFixedUniformTime | ( | int | uniformLocation | ) |
Applies the Time fixed uniform.
uniformLocation | Uniform location. |
void kanzi::Renderer::applyFixedUniformWindowSize | ( | int | uniformLocation | ) |
Applies the WindowSize fixed uniform.
uniformLocation | Uniform location. |
void kanzi::Renderer::applyTransformationUniform | ( | ShaderProgram::FixedUniform | uniform, |
int | uniformLocation | ||
) |
Applies a single transformation uniform.
Repeatedly called by applyTransformation().
uniform | Uniform type. |
uniformLocation | Uniform location. |
void kanzi::Renderer::applyTransformation | ( | ShaderProgram & | shaderProgram | ) |
Applies transformations from the renderer to the GPU.
shaderProgram | Shader program in use. |
void kanzi::Renderer::applyTextureSizeUniforms | ( | ShaderTextureUniform | textureUniforms, |
unsigned int | textureWidth, | ||
unsigned int | textureHeight | ||
) |
Applies texture uniforms for the renderer.
void kanzi::Renderer::applyTexture | ( | TextureType | type, |
unsigned int | textureUnit, | ||
unsigned int | handle | ||
) |
Sets texture settings for a given texture unit.
This only changes the renderer state and does not issue GL calls. For the changes to take effect, you must refresh the texture unit state.
type | Type of the texture (texture target) to set. |
textureUnit | Texture unit to set. |
handle | Native texture handle. |
void kanzi::Renderer::detachTexture | ( | unsigned int | textureUnit | ) |
Detaches all texture information from a given texture unit.
This only changes the renderer state and does not issue GL calls. For the changes to take effect, you must refresh the texture unit state.
textureUnit | Texture unit to set. |
void kanzi::Renderer::setActiveTextureUnit | ( | unsigned int | textureUnit | ) |
Sets the currently active texture unit.
Takes effect immediately. You can call this function manually. Kanzi also calls this function internally to refresh the render context of a texture unit.
textureUnit | Texture unit to activate. |
void kanzi::Renderer::setUniformTexture | ( | int | uniformLocation, |
unsigned int | textureUnit | ||
) |
Sets the uniform for a texture based on the currently active texture unit.
This is essentially an alias for setting an integer uniform.
uniformLocation | Uniform location to apply. |
textureUnit | Texture unit for this uniform. |
unsigned int kanzi::Renderer::bindTexture | ( | TextureType | type, |
unsigned int | handle | ||
) |
Binds specified texture of specified type to the currently active texture unit.
Takes effect immediately, and as a consequence, does not flag the texture unit render context dirty.
type | Type of texture to bind. |
handle | Native texture handle. |
unsigned int kanzi::Renderer::generateTexture | ( | ) |
Generates a new texture for the renderer.
void kanzi::Renderer::setTextureImage2D | ( | unsigned int | glTextureImageTarget, |
unsigned int | mipmapLevel, | ||
GraphicsFormat | format, | ||
unsigned int | width, | ||
unsigned int | height, | ||
const void * | data | ||
) |
Uploads texture data to the GPU.
void kanzi::Renderer::setTextureSubImage2D | ( | unsigned int | glTextureImageTarget, |
unsigned int | mipmapLevel, | ||
GraphicsFormat | format, | ||
unsigned int | x, | ||
unsigned int | y, | ||
unsigned int | width, | ||
unsigned int | height, | ||
const void * | data | ||
) |
Uploads texture subimage data to the GPU.
void kanzi::Renderer::textureStorage | ( | TextureType | type, |
int | sampleCount, | ||
int | mipmapLevelCount, | ||
GraphicsFormat | format, | ||
unsigned int | width, | ||
unsigned int | height, | ||
unsigned int | depth, | ||
bool | fixedSampleLocations | ||
) |
Specifies immutable texture format and shape.
void kanzi::Renderer::generateMipmaps | ( | TextureType | textureType | ) |
Generates mipmaps for the currently bound texture.
void kanzi::Renderer::deleteTexture | ( | unsigned int | textureHandle | ) |
Deletes a texture through the renderer.
void kanzi::Renderer::setTextureAddressingMode | ( | TextureType | type, |
Sampler::AddressingMode | texAddress | ||
) |
Sets the wrap mode for the currently bound texture in the current texture unit.
void kanzi::Renderer::setTextureFilter | ( | TextureType | type, |
Sampler::Filter | minificationFilter, | ||
Sampler::Filter | magnificationFilter, | ||
Sampler::MipmapMode | mipmapMode, | ||
float | anisotropy | ||
) |
Sets the texture filter for the currently bound texture in the current texture unit.
type | The type of the texture to edit. |
minificationFilter | Minification filter for the texture. |
magnificationFilter | Magnification filter for the texture. |
mipmapMode | Mipmap mode for the texture. |
anisotropy | Anisotropic filtering level for the texture. To disable the feature, set to a value <= 1.0f. |
void kanzi::Renderer::setTextureSwizzleMask | ( | TextureType | target, |
const TextureSwizzleMask & | mask | ||
) |
Sets the texture swizzle mask for the color and alpha channels.
You can use this method if the native OpenGL driver supports the GL_ARB_texture_swizzle or GL_EXT_texture_swizzle extension.
target | Target texture type. |
mask | Swizzle mask for the texture. This can be either a custom swizzle mask or one of these predefined ones: SwizzleMaskRGBToLuminanceAlpha, SwizzleMaskLuminanceToRGBA, and SwizzleMaskARGBToRGBA. |
void kanzi::Renderer::setTextureSwizzleEachChannel | ( | TextureType | target, |
const TextureSwizzleMask & | mask | ||
) |
Sets the texture swizzle mask for each channel separately.
You can use this method if the native OpenGL driver supports the GL_TEXTURE_SWIZZLE_R, GL_TEXTURE_SWIZZLE_G, GL_TEXTURE_SWIZZLE_B, and GL_TEXTURE_SWIZZLE_A texture parameters.
target | Target texture type. |
mask | Swizzle mask for the texture. This can be a custom swizzle mask or one of these predefined ones: SwizzleMaskRGBToLuminanceAlpha, SwizzleMaskLuminanceToRGBA and SwizzleMaskARGBToRGBA. |
void kanzi::Renderer::setTextureCompare | ( | TextureType | type, |
bool | isEnabled, | ||
GraphicsCompareFunction | textureCompareFunction | ||
) |
Sets the texture comparison function for the currently bound texture in the current texture unit.
type | The type of the texture to edit. |
isEnabled | Whether to enable the depth comparison mode for the texture. To disable depth comparison, set to false. |
textureCompareFunction | The texture comparison function to use. |
void kanzi::Renderer::setPixelStorePack | ( | unsigned int | packBytes | ) |
Sets pack row alignment in memory.
Default value is 4.
packBytes | Value for byte alignment. |
void kanzi::Renderer::setPixelStoreUnpack | ( | unsigned int | unpackBytes | ) |
Sets unpack row alignment in memory.
Default value is 4.
unpackBytes | Value for byte alignment. |
bool kanzi::Renderer::setPixelStoreUnpackRowLength | ( | unsigned int | rowLength | ) |
Sets the unpack row length.
If nonzero, specifies the number of bytes per row of image data. Use when image data rows are not aligned exactly at bytes per pixel multiplied by image width. Default value is 0.
rowLength | Number of bytes per image row. |
unsigned int kanzi::Renderer::createShader | ( | ShaderType | type | ) |
Creates a shader.
unsigned int kanzi::Renderer::createShaderProgram | ( | ) |
Creates a shader program. Returns the handle to the program.
void kanzi::Renderer::refreshRenderContext | ( | bool | geometryRendering | ) |
Refreshes the render context to contain all proper states.
void kanzi::Renderer::attachShaderToProgram | ( | unsigned int | programHandle, |
unsigned int | shaderHandle | ||
) |
Attaches a shader to a program.
void kanzi::Renderer::detachShaderFromProgram | ( | unsigned int | programHandle, |
unsigned int | shaderHandle | ||
) |
Detaches a shader from a program.
void kanzi::Renderer::bindAttributeToLocation | ( | unsigned int | programHandle, |
unsigned int | locationIndex, | ||
kzString | attributeName | ||
) |
Binds an attribute to a given location index. For example, binds "kzPosition" to 0.
bool kanzi::Renderer::linkShaderProgram | ( | unsigned int | programHandle, |
kzString | shaderName | ||
) |
Links a shader program with a given handle.
bool kanzi::Renderer::compileSourceShader | ( | ShaderType | shaderType, |
unsigned int | shaderHandle, | ||
const char *const | shaderCode, | ||
string_view | shaderName | ||
) |
Compiles a source shader and deploys it to the GPU.
bool kanzi::Renderer::deployBinaryShader | ( | unsigned int | count, |
const unsigned int * | shaders, | ||
unsigned int | binaryFormat, | ||
const void * | data, | ||
size_t | dataSize | ||
) |
Deploys a binary shader.
bool kanzi::Renderer::deployBinaryProgram | ( | unsigned int | program, |
unsigned int | binaryFormat, | ||
const void * | data, | ||
size_t | dataSize | ||
) |
Initializes shader program from program binary data.
Program binaries are specific to vendor, device, and driver. If deployBinaryProgram() succeeds, the program is in linked state. If deployBinaryProgram() fails, the program remains in the previous state.
To check whether a specific program binary format is supported by a graphics device, use isProgramBinaryFormatSupported.
To query back the program binary of a previously linked GL shader program from the graphics device, use getProgramBinary.
program | GL shader program name to initialize from program binary data. |
binaryFormat | Binary format for data. |
data | Program binary data. |
dataSize | Number of bytes in data. |
string kanzi::Renderer::getProgramBinary | ( | unsigned int | program, |
unsigned int & | binaryFormat | ||
) |
Gets the binary representation for a GL shader program.
Program binaries are specific to vendor, device, and driver.
program | The name of the GL shader program for which you want to get program binary. |
binaryFormat | GL program binary format will be returned here, or KZS_GL_NONE if no program binary format was supported by graphics device. |
void kanzi::Renderer::deleteShaderProgram | ( | unsigned int | programHandle | ) |
Deletes a shader program and the attached shaders.
void kanzi::Renderer::deleteShader | ( | unsigned int | shaderHandle | ) |
Deletes a shader.
unsigned int kanzi::Renderer::generateFramebuffer | ( | ) |
Generates new texture for the renderer.
void kanzi::Renderer::deleteFramebuffer | ( | unsigned int | frameBufferHandle | ) |
Deletes a framebuffer.
void kanzi::Renderer::bindFramebuffer | ( | unsigned int | frameBufferHandle | ) |
Binds a framebuffer.
bool kanzi::Renderer::isFramebufferComplete | ( | ) |
Returns whether the framebuffer status is complete.
If the framebuffer status is not complete, logs an error code.
void kanzi::Renderer::invalidateFramebufferAttachments | ( | FramebufferTarget | target, |
bitset< Surface::APIAttachmentCount > | attachments | ||
) | const |
Invalidates framebuffer attachments.
After invalidation, the contents of specified attachments are undefined. The graphics driver can perform performance and memory optimizations when it knows that the contents of specific attachments are no longer needed.
target | Framebuffer target to invalidate. |
attachments | Bits from Framebuffer::AttachmentBit to specify the attachments to invalidate. This function invalidates the surfaces that are attached to these attachment points. |
void kanzi::Renderer::framebufferTexture2D | ( | unsigned int | glTextureImageTarget, |
Surface::APIAttachment | attachment, | ||
unsigned int | textureHandle, | ||
unsigned int | mipmapLevel, | ||
unsigned int | implicitSampleCount | ||
) |
Attaches a texture to the currently active framebuffer.
glTextureImageTarget | GL texture image target. For a cubemap texture, this specifies the cubemap face. |
attachment | Framebuffer attachment point to which you want to attach the texture. |
textureHandle | GL texture object name to attach. |
mipmapLevel | Mipmap level of the texture to attach. |
implicitSampleCount | Sets the number of samples for implicit multisampling. To not use implicit multisampling, set to 0. |
void kanzi::Renderer::framebufferRenderbuffer | ( | Surface::APIAttachment | attachment, |
unsigned int | renderbuffer | ||
) |
Attaches a renderbuffer to the currently active framebuffer.
attachment | Framebuffer attachment point to which you want to attach the renderbuffer. |
renderbuffer | GL renderbuffer object name to attach. |
unsigned int kanzi::Renderer::generateRenderbuffer | ( | ) |
Generates a texture for the renderer.
void kanzi::Renderer::deleteRenderbuffer | ( | unsigned int | renderbuffer | ) |
Deletes a renderbuffer.
renderbuffer | The GL renderbuffer object name to delete. |
void kanzi::Renderer::bindRenderbuffer | ( | unsigned int | renderbuffer | ) |
Binds a renderbuffer for editing.
renderbuffer | The GL renderbuffer object name to bind. |
void kanzi::Renderer::renderbufferStorage | ( | GraphicsFormat | format, |
unsigned int | width, | ||
unsigned int | height, | ||
unsigned int | explicitSampleCount | ||
) |
Sets storage for the currently bound renderbuffer.
format | GraphicsFormat for the renderbuffer. |
width | Width for the renderbuffer in pixels. |
height | Height for the renderbuffer in pixels. |
explicitSampleCount | Number of multisample samples. |
unsigned int kanzi::Renderer::generateBuffer | ( | ) |
Generates new index or vertex buffer or uniform buffer object name.
void kanzi::Renderer::setVertexBufferData | ( | size_t | dataSize, |
const void * | data | ||
) |
Sets static vertex buffer data.
void kanzi::Renderer::setIndexBufferData | ( | size_t | dataSize, |
const void * | data | ||
) |
Sets static index buffer data.
void kanzi::Renderer::setVertexBufferSubData | ( | unsigned int | offset, |
size_t | size, | ||
const void * | data | ||
) |
Uploads vertex buffer subdata with given offset and size.
void kanzi::Renderer::setIndexBufferSubData | ( | unsigned int | offset, |
size_t | size, | ||
const void * | data | ||
) |
Uploads index buffer subdata with given offset and size.
void kanzi::Renderer::deleteBuffer | ( | unsigned int | handle | ) |
Deletes vertex, index, or instance buffer.
void* kanzi::Renderer::mapVertexBuffer | ( | unsigned int | size, |
BufferAccessMode | mode | ||
) |
Maps vertex or instance buffer.
size | Size in bytes of the mapped area of the buffer. |
mode | Buffer access mode, which can be read, write, or both. |
bool kanzi::Renderer::unmapVertexBuffer | ( | ) |
Unmaps vertex or instance buffer.
void* kanzi::Renderer::mapIndexBuffer | ( | unsigned int | size, |
BufferAccessMode | mode | ||
) |
Maps index buffer.
size | Size in bytes of the mapped area of the buffer. |
mode | Buffer access mode, which can be read, write, or both. |
bool kanzi::Renderer::unmapIndexBuffer | ( | ) |
Unmaps index buffer.
void kanzi::Renderer::enableVertexAttributeArray | ( | unsigned int | attributeHandle | ) |
Sets vertex attribute array to be enabled.
attributeHandle | Index to the attribute to enable. |
void kanzi::Renderer::disableVertexAttributeArray | ( | unsigned int | attributeHandle | ) |
Sets vertex attribute array to be disabled.
attributeHandle | Index to the attribute to disable. |
void kanzi::Renderer::applyVertexAttributeArrays | ( | ) |
Updates vertex attribute configurations to the graphics driver.
If you change the vertex attribute configuration with enableVertexAttributeArray(), disableVertexAttributeArray(), or setVertexBufferPointer(), call this function before each draw call.
|
inline |
Sets the attribute data source for the currently enabled vertex attribute array.
location | Attribute location. |
dimension | Number of vector components in the attribute. Valid values are 1, 2, 3, and 4. |
attributeDataType | Data type of the attribute. |
stride | Stride, that is, the number of bytes to get from one vertex to the next vertex. Valid values are positive integers. |
data | If the current vertex buffer is non-zero, this is the offset in bytes to the current vertex buffer GPU memory. If the current vertex buffer is zero, this is the CPU memory address to the attribute data. |
void kanzi::Renderer::setVertexBufferPointer | ( | unsigned int | location, |
int | dimension, | ||
GraphicsDataType | attributeDataType, | ||
int | stride, | ||
unsigned int | divisor, | ||
const void * | data | ||
) |
Sets the attribute data source for the currently enabled vertex attribute array.
location | Attribute location. |
dimension | Number of vector components in the attribute. Valid values are 1, 2, 3, and 4. |
attributeDataType | Data type of the attribute. |
stride | Stride, that is, the number of bytes to get from one vertex to the next vertex. Valid values are positive integers. |
divisor | Attribute rate divisor: zero for vertex attributes, 1+ for instance attributes. |
data | If current vertex buffer is non-zero, this is the offset in bytes to the current vertex buffer GPU memory. If the current vertex buffer is zero, this is the CPU memory address to the attribute data. |
void kanzi::Renderer::setActiveShaderHandle | ( | unsigned int | activeShaderHandle, |
const int * | vertexAttributeMap | ||
) |
Sets the active shader for the renderer.
unsigned int kanzi::Renderer::getActiveShaderHandle | ( | ) | const |
Gets the active shader handle from the renderer.
const int* kanzi::Renderer::getActiveShaderAttributeMap | ( | ) | const |
Gets the active vertex attribute map from the renderer.
void kanzi::Renderer::setDefaultFramebuffer | ( | unsigned int | frameBufferHandle | ) |
Sets the default framebuffer (screen) for the renderer.
void kanzi::Renderer::setActiveFramebuffer | ( | unsigned int | frameBufferHandle | ) |
Sets the active framebuffer for the renderer.
frameBufferHandle | Handle to bind for rendering. |
void kanzi::Renderer::setColorBufferCount | ( | unsigned int | colorBufferCount | ) |
Sets the number of draw color buffers for the currently active framebuffer.
colorBufferCount | Number of color attachments. |
void kanzi::Renderer::resetActiveFramebuffer | ( | ) |
Resets the active framebuffer for the renderer to the default (screen).
void kanzi::Renderer::setActiveFramebufferCallback | ( | FramebufferCallback | callbackFunction | ) |
Sets the callback function that is called after setActiveFramebuffer.
unsigned int kanzi::Renderer::getActiveFramebuffer | ( | ) | const |
Gets the active framebuffer handle from the renderer.
void kanzi::Renderer::readPixels | ( | int | x, |
int | y, | ||
int | width, | ||
int | height, | ||
GraphicsFormat | format, | ||
void * | pixels | ||
) |
Reads the pixels from the current framebuffer.
GraphicsFormat kanzi::Renderer::getNativePixelReadFormat | ( | ) |
Gets the native pixel read format from the renderer.
void kanzi::Renderer::beginMaterialSetup | ( | ) |
Begins a material for the renderer.
void kanzi::Renderer::endMaterialSetup | ( | ) |
Ends a material for the renderer.
void kanzi::Renderer::beginVertexArray | ( | ) |
Begins a set of vertex arrays.
void kanzi::Renderer::setVertexArrayData | ( | VertexAttribute::Semantic | attribute, |
GraphicsDataType | dataType, | ||
const void * | data, | ||
unsigned int | stride | ||
) |
Sets vertex array data.
Value 0u for stride means that the elements are tightly packed.
attribute | Semantic attribute. |
dataType | Vertex data type. |
data | Vertex data pointer. |
stride | Vertex stride in bytes. |
|
inline |
Sets vertex array data wrapper.
Stride defaults to 0u.
attribute | Semantic attribute. |
dataType | Vertex data type. |
data | Vertex data pointer. |
|
inline |
Sets vertex array data wrapper.
Data type defaults to 32-bit float.
attribute | Semantic attribute. |
data | Vertex data pointer. |
stride | Vertex stride in bytes. |
|
inline |
Sets vertex array data wrapper.
Data type defaults to 32-bit float. Stride defaults to 0u.
attribute | Semantic attribute. |
data | Vertex data pointer. |
void kanzi::Renderer::endVertexArray | ( | GraphicsPrimitiveType | primitiveType, |
unsigned int | count | ||
) |
Ends a vertex array. Renders the specified vertex lists and finishes the usage.
unsigned int kanzi::Renderer::getCurrentVertexArrayFlags | ( | ) | const |
Gets the current vertex array flags from the renderer.
const void* kanzi::Renderer::getCurrentVertexArrayAttributeData | ( | VertexAttribute::Semantic | attribute | ) | const |
Gets the current vertex array data from the renderer. Reset when switching the shader.
float kanzi::Renderer::getLineWidth | ( | ) | const |
Gets the line width assigned to the renderer.
The default line width is 1.0f.
void kanzi::Renderer::setLineWidth | ( | float | lineWidth | ) |
Sets the line width for the renderer.
The default line width is 1.0f.
lineWidth | Line width. |
Vector2 kanzi::Renderer::getPolygonDepthOffset | ( | ) | const |
Gets the polygon depth offset assigned to the renderer.
If the offset is Vector2(0.0f, 0.0f), the feature is disabled.
void kanzi::Renderer::setPolygonDepthOffset | ( | Vector2 | offset | ) |
Sets the polygon depth offset for the renderer.
This affects the depth offset of filled polygons only. Kanzi calculates the offset to add as:
dz * X + units * Y
Where:
To disable the feature, set both components to the default value 0.0f.
offset | Depth offset multipliers (derivative, constant). |
|
inline |
Sets the polygon depth offset for the renderer.
derivativeMultiplier | Multiplier for the Z derivative. |
constantMultiplier | Multiplier for the constant units. |
void kanzi::Renderer::flush | ( | ) | const |
Flushes the GPU pipeline, forces all commands to be executed in finite time.
void kanzi::Renderer::pushStatistics | ( | ) |
void kanzi::Renderer::popStatistics | ( | ) |
uint64_t kanzi::Renderer::getIndexCount | ( | ) | const |
Gets the index count from the renderer.
uint64_t kanzi::Renderer::getTriangleCount | ( | ) | const |
Gets the triangle count from the renderer.
uint64_t kanzi::Renderer::getVertexCount | ( | ) | const |
Gets the vertex count from the renderer.
uint64_t kanzi::Renderer::getInstanceCount | ( | ) | const |
Gets the instance count from the renderer.
unsigned int kanzi::Renderer::getBatchCount | ( | ) | const |
Gets the batch count from the renderer. This is the number of draw calls, such as drawElements and drawArrays.
unsigned int kanzi::Renderer::getShaderSwitchCount | ( | ) | const |
Gets the number of shader switches from the renderer.
unsigned int kanzi::Renderer::getUniformSendCount | ( | ) | const |
Gets uniform sending count from the renderer.
unsigned int kanzi::Renderer::getTextureSwitchCount | ( | ) | const |
Gets the number of texture switches from the renderer.
unsigned int kanzi::Renderer::getFramebufferSwitchCount | ( | ) | const |
Gets the number of framebuffer switches from the renderer.
unsigned int kanzi::Renderer::getBufferSwitchCount | ( | ) | const |
Gets the number of VBO and IBO switches from the renderer.
unsigned int kanzi::Renderer::getHeavyweightCallCount | ( | ) | const |
Returns potentially heavyweight calls, such as buffer or texture updates and glFinish, from the renderer.
Potential due to GPU implementation can decide when heavyweight occurs. For example, reading cannot be performed before a write operation finishes.
bool kanzi::Renderer::isShaderBinaryFormatSupported | ( | unsigned int | glShaderBinaryFormat | ) | const |
Returns whether a GL shader binary format is supported.
glShaderBinaryFormat | GL shader binary format to check. |
bool kanzi::Renderer::isProgramBinaryFormatSupported | ( | unsigned int | glProgramBinaryFormat | ) | const |
Returns whether a GL program binary format is supported.
glProgramBinaryFormat | GL program binary format to check. |
void kanzi::Renderer::setGPUCallsEnabled | ( | bool | enabled | ) |
Sets GPU calls as enabled or disabled.
bool kanzi::Renderer::GPUCallsIsEnabled | ( | ) | const |
Returns whether GPU calls are enabled.
bool kanzi::Renderer::isSupported | ( | RendererSupport | feature | ) | const |
Returns whether coverage buffer is supported.
feature | Feature to check. |
Multisample kanzi::Renderer::getMultisampleSupport | ( | ) | const |
Returns the support for multisample textures and renderbuffers.
ProgramBinary kanzi::Renderer::getProgramBinarySupport | ( | ) | const |
Returns the support for program binaries.
HalfFloatTexture kanzi::Renderer::getHalfFloatTextureSupport | ( | ) | const |
Returns the support for half float texture format.
|
inline |
Returns the support for half-float vertex attribute.
|
inline |
Returns whether half-float vertex attribute is supported.
FloatTexture kanzi::Renderer::getFloatTextureSupport | ( | ) | const |
Returns the support for float texture format.
TexStorage kanzi::Renderer::getTexStorageSupport | ( | ) | const |
Returns the support for tex storage.
DrawBuffers kanzi::Renderer::getDrawBuffersSupport | ( | ) | const |
Returns the support for draw buffers.
bool kanzi::Renderer::getTexStorageSupport | ( | TextureType | type, |
unsigned int | samples | ||
) | const |
Returns the support for tex storage.
type | Texture type requested. |
samples | Sample count requested. |
void* kanzi::Renderer::createImageObject | ( | void * | dataPointer, |
int | target, | ||
int * | attributes | ||
) |
Creates an image object, returns NULL if no hardware support.
Image object can be bound as texture input. Requires surface to be set for the renderer via setSurface, otherwise throws an error.
void kanzi::Renderer::deleteImageObject | ( | void * | imageObject | ) |
Deletes an image object created with createImageObject.
void kanzi::Renderer::setImageTargetTexture | ( | TextureType | type, |
void * | imageObject | ||
) |
Sets an image object bound to the currently bound texture type.
float kanzi::Renderer::getMaximumAnisotropy | ( | ) | const |
Gets maximum anisotropy.
unsigned int kanzi::Renderer::getMaximumTextureSize | ( | TextureType | textureType | ) | const |
Gets maximum texture side size.
unsigned int kanzi::Renderer::getMaximumRenderbufferSize | ( | ) | const |
Gets maximum renderbuffer size.
unsigned int kanzi::Renderer::getMaximumViewportWidth | ( | ) | const |
Gets maximum viewport width.
unsigned int kanzi::Renderer::getMaximumViewportHeight | ( | ) | const |
Gets maximum viewport height.
unsigned int kanzi::Renderer::getMaximumVertexAttributeCount | ( | ) | const |
Gets maximum vertex attribute count.
unsigned int kanzi::Renderer::getMaximumSampleCount | ( | ) | const |
Gets maximum sample count for multisampling.
int kanzi::Renderer::getColorReadFormat | ( | ) |
Returns GL constant for the color read format used in reading back data from framebuffer (RendererReadPixels).
int kanzi::Renderer::getColorReadType | ( | ) |
Returns GL constant for the color read type used in reading back data from framebuffer (RendererReadPixels).
void kanzi::Renderer::invalidateAllocations | ( | ) |
Invalidates all handles from renderer without affecting GL state.
void kanzi::Renderer::logOpenGLInformation | ( | unsigned int | flags | ) | const |
Logs information about renderer capabilities.
void kanzi::Renderer::resolveMultisample | ( | NativeFramebufferHandle | sourceFramebuffer, |
NativeFramebufferHandle | destinationFramebuffer, | ||
unsigned int | srcOffsetX, | ||
unsigned int | srcOffsetY, | ||
unsigned int | srcWidth, | ||
unsigned int | srcHeight, | ||
unsigned int | dstOffsetX, | ||
unsigned int | dstOffsetY, | ||
unsigned int | dstWidth, | ||
unsigned int | dstHeight, | ||
bool | color, | ||
bool | depth, | ||
bool | stencil | ||
) |
Resolves a multisample framebuffer.
Performs a blit from a source framebuffer to a destination framebuffer. This has the implicit effect of resolving multisample samples.
sourceFramebuffer | Source framebuffer handle. |
destinationFramebuffer | Destination framebuffer handle. |
srcOffsetX | Copied area x offset in source framebuffer. |
srcOffsetY | Copied area y offset in source framebuffer. |
srcWidth | Copied area width in source framebuffer. |
srcHeight | Copied area height in source framebuffer. |
dstOffsetX | Copied area x offset in destination framebuffer. |
dstOffsetY | Copied area y offset in destination framebuffer. |
dstWidth | Copied area width in destination framebuffer. |
dstHeight | Copied area height in destination framebuffer. |
color | Whether to resolve the color channel. |
depth | Whether to resolve the depth channel. |
stencil | Whether to resolve the stencil channel. |
|
inline |
Resolves a multisample framebuffer.
Performs a blit from a source framebuffer to a destination framebuffer. This has the implicit effect of resolving multisample samples. Only resolves the color buffer.
sourceFramebuffer | Source framebuffer handle. |
destinationFramebuffer | Destination framebuffer handle. |
srcOffsetX | Copied area x offset in source framebuffer. |
srcOffsetY | Copied area y offset in source framebuffer. |
srcWidth | Copied area width in source framebuffer. |
srcHeight | Copied area height in source framebuffer. |
dstOffsetX | Copied area x offset in destination framebuffer. |
dstOffsetY | Copied area y offset in destination framebuffer. |
dstWidth | Copied area width in destination framebuffer. |
dstHeight | Copied area height in destination framebuffer. |
void kanzi::Renderer::resolveMultisample | ( | Texture & | src, |
Texture & | dst, | ||
unsigned int | offsetX, | ||
unsigned int | offsetY, | ||
unsigned int | width, | ||
unsigned int | height, | ||
bool | color, | ||
bool | depth | ||
) |
Resolves multisample samples from a source texture to a destination texture.
src | Source texture which has multisampling enabled. |
dst | Destination texture which has multisampling disabled. |
offsetX | Copied area x offset both in source and target texture. |
offsetY | Copied area y offset both in source and target texture. |
width | Width of the area to copy from source to destination. |
height | Height of the area to copy from source to destination. |
color | Whether to resolve the color channel. |
depth | Whether to resolve the depth channel. |
|
inline |
Resolves multisample samples from a source texture to a destination texture.
Only resolves the color buffer.
src | Source texture which has multisampling enabled. |
dst | Destination texture which has multisampling disabled. |
offsetX | Copied area x offset both in source and target texture. |
offsetY | Copied area y offset both in source and target texture. |
width | Width of the area to copy from source to destination. |
height | Height of the area to copy from source to destination. |
void kanzi::Renderer::setFillMode | ( | GraphicsFillMode | mode | ) |
Sets the polygon fill mode if supported by the backend.
The default fill mode is kanzi::GraphicsFillModeSolid.
mode | The polygon fill mode. |
|
inline |
Gets the current viewport rectangle from the renderer.
|
inline |
Gets the current scissor rectangle from the renderer.
Returns the rectangle even if scissor test is not enabled. In this situation, it is the last set scissor rectangle.
|
inline |
Enables a renderer workaround.
|
inline |
Disables a renderer workaround.
|
inline |
Return whether a workaround is enabled.
|
inline |
Sets workaround enable state to true or false.
GraphicsFormat kanzi::Renderer::findValidTextureFormat | ( | GraphicsFormat | format, |
unsigned int | features | ||
) | const |
Finds a valid texture format that is supported by the graphics adapter and is compatible with a given format.
The returned format must be binary-compatible with the format parameter. For example, input ETC1 format can return ETC2 format.
format | The format with which the result format should be compatible. |
features | Usage bits that should be supported by the format. |
unsigned int kanzi::Renderer::getFeatures | ( | GraphicsFormat | format | ) | const |
Describes what a format can be used for in the renderer.
bool kanzi::Renderer::supports | ( | GraphicsFormat | format, |
unsigned int | features | ||
) | const |
Returns whether a format supports requested features.
bool kanzi::Renderer::supportsTexture | ( | GraphicsFormat | format | ) | const |
Returns whether a format can be used as a texture by the renderer.
bool kanzi::Renderer::supportsRenderbuffer | ( | GraphicsFormat | format | ) | const |
Returns whether a format can be used as renderbuffer by the renderer.
bool kanzi::Renderer::supportsColorAttachment | ( | GraphicsFormat | format | ) | const |
Returns whether a format can be used as color attachment in framebuffers.
bool kanzi::Renderer::supportsDepthStencilAttachment | ( | GraphicsFormat | format | ) | const |
Returns whether a format can be used as depth-stencil attachment in framebuffers.
GraphicsFormat kanzi::Renderer::getFallback | ( | GraphicsFormat | format, |
unsigned int | usageFlags | ||
) | const |
Returns a fallback format which supports specified usage flags.
GraphicsFormat kanzi::Renderer::getDepthStencilFormatForRenderbuffer | ( | bool | depth, |
bool | stencil | ||
) | const |
Returns a depth-stencil renderbuffer format which is supported by the renderer.
GraphicsFormat kanzi::Renderer::getDepthStencilFormatForTexture | ( | bool | depth, |
bool | stencil | ||
) | const |
Returns a depth-stencil texture format which is supported by the renderer.
|
inline |
For a given vertex attribute, specified by attribute location, configures attribute dimension, datatype, stride, and starting offset in the current vertex buffer.
location | Attribute location to modify. |
dimension | Dimension for the attribute. Valid values are 1, 2, 3, and 4. |
dataType | Data type for the attribute. |
stride | Stride for the attribute. Valid values are positive integers. |
data | Starting offset of the attribute data in the current vertex buffer GPU memory. If the current vertex buffer is 0, this is the starting address for the attribute data in CPU memory. |
void kanzi::Renderer::applyAttributePointer | ( | unsigned int | location, |
int | dimension, | ||
GraphicsDataType | dataType, | ||
int | stride, | ||
unsigned int | divisor, | ||
const void * | data | ||
) | const |
For a given vertex or instance attribute specified by location, configures the dimension, datatype, stride, and starting offset in the current vertex buffer.
location | Attribute location to modify. |
dimension | Dimension for the attribute. Valid values are 1, 2, 3, and 4. |
dataType | Data type for the attribute. |
stride | Stride for the attribute. Valid values are positive integers. |
divisor | Divisor for the attribute. Value 0 means that the attribute is per vertex. Values 1 and higher mean that the attribute is per instance. |
data | Starting offset of the attribute data in the current vertex buffer GPU memory. If the current vertex buffer is 0, this is the starting address for the attribute data in CPU memory. |
void kanzi::Renderer::getGLFormatTriplet | ( | GraphicsFormat | format, |
unsigned int | features, | ||
unsigned int * | out_glFormat, | ||
unsigned int * | out_glInternalFormat, | ||
unsigned int * | out_glType | ||
) | const |
Returns GL API format, internal format, type triplet for given Format.
bool kanzi::Renderer::supportsTexStorage | ( | GraphicsFormat | format, |
unsigned int | features | ||
) | const |
Returns whether a graphics format supports texture storage.
void kanzi::Renderer::clearUniformCaches | ( | ) |
Free memory used by uniform caches.
void kanzi::Renderer::advanceGlobalTime | ( | chrono::milliseconds | deltaTime | ) |
Advances renderer wall clock with time delta.
deltaTime | Wall clock delta time. |
chrono::milliseconds kanzi::Renderer::getGlobalTime | ( | ) | const |
Gets wall clock time in milliseconds since program start.
int kanzi::Renderer::getGlesVersion | ( | ) | const |
Returns the supported OpenGL ES version.
The version is encoded into an integer using this formula: major version times 100 plus minor version times ten. For example, value 310 means version 3.1.
bool kanzi::Renderer::getLogging | ( | ) | const |
Returns whether the logging of OpenGL API calls is enabled.
bool kanzi::Renderer::getDumpStateOnDrawCalls | ( | ) | const |
Returns current dump state on draw calls setting.
void kanzi::Renderer::setLogging | ( | bool | enabled, |
bool | dumpStateOnDrawCalls | ||
) |
Enables or disables the logging of OpenGL API calls.
enabled | Whether to enable the logging of OpenGL API calls. |
dumpStateOnDrawCalls | New dump state on draw calls setting. |
|
inline |
Sets whether the current program has an active tessellation shader, which requires overriding the primitive type to GL_PATCHES.
hasTessellationShader | Whether the program has an active tessellation shader. |
bool kanzi::Renderer::loadProgramFromCache | ( | const ShaderProgram::CreateInfo & | info, |
unsigned int | program | ||
) |
Tries to load a shader program from the cache.
info | Shader create info with shader sources. |
program | GL program handle. |
void kanzi::Renderer::saveProgramToCache | ( | const ShaderProgram::CreateInfo & | info, |
unsigned int | program | ||
) |
Saves a shader program to cache.
info | Shader create info with shader sources. |
program | GL program handle. |
string kanzi::Renderer::getCacheFilePath | ( | const ShaderProgram::CreateInfo & | info | ) |
Forms a full shader cache file path from the shader create info.
info | Shader create info with shader sources. |
|
inline |
Sets the current screen size.
screenSize | The screen size in pixels. |
|
friend |
And assignment operator for rendering change state flags.
lhs | Left-hand-side operand. |
rhs | Right-hand-side operand. |
|
friend |
Or assignment operator for rendering change state flags.
lhs | Left-hand-side operand. |
rhs | Right-hand-side operand. |
|
friend |
Xor assignment operator for rendering change state flags.
lhs | Left-hand-side operand. |
rhs | Right-hand-side operand. |